The image is transformed over gray transform 、 median filtering 、 the segmentation algorithm of the optimal threshold and Robert edge detection to remove the impurities of the image and get the edge information. At the moment, the profile of workpiece can be seen in the image. 采用图像处理技术完成灰度处理、中值滤波、最佳阈值分割、Robert边缘检测等步骤去除图像杂质,获取工件的边缘信息,这时可以清晰地看到工件的轮廓。